<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="cn.company.bean.HoldClient"%>
<%@page import="cn.company.database.DBUtils"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="java.util.List"%>
<%@page import="cn.company.bean.Sort"%><html>
<head>
<%
	String path = request.getContextPath();
	
	int ids = Integer.parseInt(request.getParameter("id"));
	HoldClient holdclient = DBUtils.getHoldClientById(ids);
	List<Sort> sorts = DBUtils.getSortsByModuleId(3);
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>网站后台管理系统</title>
<script language="javascript" src="<%=path %>/OurHome/images/jquery.js"></script>
<link href="<%=path %>/OurHome/css/index.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
	function callback(msg){
		 document.getElementById("msg").innerHTML = msg;  
		 document.getElementById("path").value=msg;
	}
</script>
</head>
<body>
	<div id="mainDiv">
		<c:import url="../public/top.jsp" />
		<div id="centerDiv">
			<c:import url="../public/navigation.jsp"></c:import>
			<div id="right"> 
				<div id="current">&nbsp;&nbsp;&nbsp;&nbsp;当前位置: 现有客户</div>
				<div id="form">
					<P>&nbsp;</P>
					<fieldset>
						<legend>修改客户:</legend>
						<form action="<%=path %>/OurHome/uploadAttaches.jsp" method="post" enctype="multipart/form-data" target="uploadIframe">
							添加客户图片：<input type="file" name="upload"/>
							<input type="submit" value="上传"/><br>
							<span id="msg"></span>
						</form>
						<iframe name="uploadIframe" id="uploadIframe" style="display:none"></iframe>
						<form action="<%=path %>/OurHomeControlServlet" method="post">
							<input type="hidden" name="action" value="updateholdclient" />
							<input type="hidden" name="id" id="id" value="<%=ids %>" />
							<input type="hidden" name="path" id="path" value="<%=holdclient.getImagepath() %>"/>
							客户名称：<input type="text" id="clientname" name="clientname" value="<%=holdclient.getName() %>"/><br>
							链接：<input type="text" id="url" name="url" value="<%=holdclient.getUrl() %>" size="50"/>格式：(http://www.baidu.com)<br>
							客户排序：<input type="text" id="taxis" name="taxis" value="<%=holdclient.getTaxis() %>" /><br>
							分类 ：
							<%
								for(int i = 0;i < sorts.size();i++){
							%>
									<%=sorts.get(i).getSortName() %> : <input <%if (holdclient.getSortid().indexOf(String.valueOf(sorts.get(i).getId())) != -1) { %>checked="checked"<% } %> type="checkbox" name="type" value="<%=sorts.get(i).getId() %>" />
							<%
								}
							%>
							<br>
							<c:set var="content" value="<%=holdclient.getContent() %>"></c:set>
							<c:url value="../../jsp/demo2.jsp" var="contextUrl"><c:param name="content" value="${content}" /></c:url>
							客户简介：<c:import url="${contextUrl}"></c:import>
							客户图片：<img alt="<%=holdclient.getName() %>" src="<%=path %>/<%=holdclient.getImagepath()%>" style="width:60px;height:60px;"/><br>
							<input type="submit" value="提交内容" id="submit" name="submit"/>
						</form>
					</fieldset>
				</div>
			</div>
		</div>
		<div id="bottomDiv"></div>
	</div>
	<script language="javascript">
		$("#test1").toggle(function(){$("#test").slideDown();},function(){$("#test").slideUp();});
	</script>
</body>
</html>
